<include file="public@header" />
</head>
<style>
    td input,td select{ width:auto; max-width:180px;}
</style>
<body>
<php>$page=''</php>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('finance/index')}">常规维保</a></li>
        <li class="active"><a href="{:url('finance/payburied')}">交费打证</a></li>
    </ul>
    <form  class="form-horizontal js-ajax-form" method="post" action="{:url('Orders/index')}">
        <div class="div_title"><span>客户概览</span></div>
        <div class="control-group1-p div_content">
            <div class="control-group1">
                <label class="control-label">客户姓名</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.buyer_name}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">持证类型</label>
                <div class="controls">
                    <input type="text" class="form-control" value="身份证" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">证件号码</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.customer_account}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">联系电话</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.buyer_phone}" disabled>
                </div>
            </div>
            <div class="control-group1" style="width:50%;">
                <label class="control-label">联系地址</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.customer_address}" style="width:80%;" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">合同编号</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.contract_sn}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">购买日期</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.gm_start_time}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">打证日期</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.dz_start_time}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">保修状态</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.bxq_status}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">当前状态</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.col_status_name}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">维护期</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.whq_status}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">墓位编号</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.tomb_num}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">具体位置</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.tomb_region}{$result.tomb_address}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">墓穴规制</label>
                <div class="controls">
                    <input type="text" class="form-control" value="{$result.tomb_regulation_name}" disabled>
                </div>
            </div>
            <div class="control-group1">
                <label class="control-label">单个内穴最大尺寸</label>

                <div class="controls">
                    <input type="text" class="form-control" value="400mm*400mm*400mm" disabled>
                </div>
            </div>
            <!---tab页-->
            <ul class="nav_tabs">
                <li class="active"><a href="javascript:">缴费打证</a></li>
                <li><a href="javascript:">缴费记录</a></li>
            </ul>
            <div class="control-group1-p nav_content">
                <div class="content_nav">
                    <div class="p_title">
                        <span class="span_title">缴费项目</span>
                    </div>
                    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">

                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>收费项目</th>
                                <th>单位</th>
                                <th>项目类型</th>
                                <th>单价</th>
                                <th>折扣优惠</th><th>减免金额</th>
                                <th>落葬费</th>
                                <th>应收金额</th>
                            </tr>
                            </thead>
                            <tbody>
                            <foreach name="project_list" item="vo">
                                <tr >
                                    <td>{$vo.project_name}
                                        <input type="hidden" class="project_name" name="project[{$key}][project_name]" value="{$vo.project_name}"/></td>
                                    <td>
                                        <input type="hidden" class="tomb_id" name="project[{$key}][tomb_id]" value="{$result.tomb_id}"/>
                                        <input type="hidden" class="project_unit" name="project[{$key}][project_unit]" value="{$vo.project_unit}"/>
                                        {$vo.project_unit}</td>
                                    <td> <input type="hidden" class="project_type"  name="project[{$key}][project_type]" value="{$vo.project_type}"/>
                                        {$vo.project_type}</td>
                                    <td>
                                        <if condition="$vo.type eq 1">
                                            <input type="hidden" class="unit_price"  name="project[{$key}][unit_price]" value="{$vo.unit_price}"/>
                                            <input type="hidden" class="num"  name="project[{$key}][num]"  value="{$vo.num}"/>
                                            <input type="hidden" class="deal_price" name="project[{$key}][deal_price]"  value="{$vo.unit_price*$vo.num}"/>
                                            {$vo.unit_price}*{$vo.num}
                                            <else />
                                            <input type="hidden" class="num"  name="project[{$key}][num]"  value="{$vo.num}"/>
                                            <input type="hidden" class="deal_price" name="project[{$key}][deal_price]"  value="{$vo.unit_price}"/>
                                            <input type="hidden" class="unit_price" name="project[{$key}][unit_price]" value="{$vo.unit_price}"/> {$vo.unit_price}
                                        </if></td>
                                    <td>
                                        <if condition="$vo.type eq 1">
                                            {$vo.discount_rate}%
                                            <input type="hidden"  name="project[{$key}][discount_rate]" value="{$vo.discount_rate}" />
                                            <else />
                                            <input type="hidden"  name="project[{$key}][discount_rate]" value="{$vo.discount_rate}" />
                                        </if>

                                    </td>
                                    <td>
                                        <if condition="$vo.type eq 1">
                                            <input type="hidden"  name="project[{$key}][free_price]"  class="form-control free_price " style="max-width:80px; width:auto;" value="{$vo.free_price}"/>
                                            {$vo.free_price}
                                            <else />
                                            <input type="hidden"  name="project[{$key}][free_price]" value="0" />
                                        </if>
                                    </td>
                                    <td>
                                        <if condition="$vo.type eq 0">
                                            <input type="hidden" class="unit_price"  name="project[{$key}][unit_price]" value="{$vo.unit_price}"/>
                                            <label class="unit_price">{$vo.unit_price}</label>
                                            <else />
                                            <input type="hidden"  name="project[{$key}][unit_price]" value="0" />
                                        </if>
                                    </td>
                                    <td>
                                        <input type="hidden" class="total_price"  name="project[{$key}][total_price]" value="{$vo.total_price}"/>
                                        <label class="total_price">{$vo.total_price}</label>
                                    </td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>

                    <div class="p_title">
                          <span class="span_title">缴费详情</span>
                      </div>
                      <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                      <form action="{:url('Rock/order')}" method="post">
                      <table class="table table-hover table-bordered">
                          <thead>
                              <tr>
                                  <th>原价总计</th>
                                  <th>减免总计</th>
                                  <th>应收总计</th>
                                  <th>实收金额 </th>
                                  <th>付款方式</th>
                                  <th>收款人</th>
                                  <th>收款时间</th>
                                  <th>收款复核</th>
                              </tr>
                          </thead>
                          <tbody>
                              <tr>
                                  <td><input type="text" class="form-control" value="{$pay_info.deal_price}" disabled></td>
                                  <td><input type="text" class="form-control" name="free_price" value="{$pay_info.free_price}" disabled></td>
                                  <td><input type="text" class="form-control" value="{$pay_info.total_price}" disabled></td>
                                  <td><input type="text" class="form-control" value="{$pay_info.total_price}" disabled></td>
                                  <td> <select name="pay_type" id="pay_type"   class="form-control">
                                      <option value="1">现金</option>
                                      <option value="2">转账</option>
                                      <option value="3">电汇</option>
                                      <option value="4">微信</option>
                                      <option value="5">支付宝</option>
                                      <option value="6">其他</option>
                                  </select></td>
                                  <td><input type="text" class="form-control" id="real_name" name="real_name" value=""></td>
                                  <td><input type="text" class="form-control js-datetime" value=""></td>
                                  <td>
                                      <input type="hidden" id="pay_id" value="{$pay_info.id}">
                                      <input type="hidden" id="order_id" value="{$pay_info.order_id}">
                                      <input type="hidden" id="tomb_id" value="{$pay_info.tomb_id}">
                                      <input type="hidden" id="tomb_regulation" value="{$result.tomb_regulation}">

                                      <if condition="$pay_info.status eq 0">
                                        <div class="btn btn-primary" id="check-Confirmpayment">确认收款</div>
                                      </if>
                                  </td>
                              </tr>
                          </tbody>
                      </table>
                      <div class="pagination">{$page}</div>
                      </form>
                    </div>
                    <div class="form-actions">
                        <div class="btn btn-primary" id="check-save">保存</div>
                      <div class="btn btn-primary toPrint" data-url="{:url('')}?ajax=1&order_id={$order_id}&pay_id={pay_id}"
                           data-title="打印结算单" data-width="885px" data-height="750px" data-key="1"  >打印结算单</div>
                      <div class="btn btn-primary toPrint" data-url="{:url('')}?ajax=2&order_id={$order_id}&pay_id={pay_id}"
                           data-title="打印落葬单" data-width="885px" data-height="510px"  data-key="2"  >打印落葬单</div>
                      <div class="btn btn-primary toPrint" data-url="{:url('')}?ajax=3&order_id={$order_id}&pay_id={pay_id}"
                           data-title="打印预览" data-width="885" data-height="750px" data-key="3" >打印预览</div>
                    </div>
                </div>
                <div class="content_nav feature">
                    <div class="p_title">
                        <span class="span_title">缴费记录</span>
                    </div>
                    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">

                            <table class="table table-hover table-bordered" style="max-width: 160% !important;width: 160% !important;">
                                <thead>
                                <tr>
                                    <th>逝者姓名</th>
                                    <th>性别</th>
                                    <th>生卒日期</th>
                                    <th>落葬时间</th>
                                    <th>收敛形式</th>
                                    <th >落葬类别</th>
                                    <th >与持证人关系</th>
                                    <th >火化证明</th>
                                    <th >办理人信息</th>
                                    <th >接待部门</th>
                                    <th >执行情况</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="pay_list" item="vo">
                                    <tr>
                                        <td>逝者姓名</td>
                                        <td>性别</td>
                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript" src="__STATIC__/js/print.js"></script>
<script type="text/javascript">
    //切换显示
    $(document).on('click','.nav_tabs li',function(){
        $(this).addClass('active').siblings().removeClass('active');
        var index = $(".nav_tabs li").index(this);
        billtype = index;
        console.log(index);
        $('.content_nav').eq(index).removeClass("feature").siblings().addClass("feature");
    });

    // 提交订单
    $("#check-Confirmpayment").click(function(){
        $("#otype").val(1);
        $.post("{:url()}", {
            pay_type:$('#pay_type').val(),
            real_name:$('#real_name').val(),
            pay_id:$('#pay_id').val(),
            tomb_id:$('#tomb_id').val(),
            order_id:$('#order_id').val(),
            tomb_regulation:$('#tomb_regulation').val(),
        }, function(result){
            if(result.code == 1){
                alert("保存成功！");
                window.location.href = result.url;
            } else {
                alert(result.code);
            }
        }, 'json');
    });

    // 提交订单
    $("#check-save").click(function(){
        $("#otype").val(1);
        $.post($(".form-horizontal").attr('action'), $(".form-horizontal").serialize(), function(result){
            if(result.code == 1){

                // window.location.href = result.url;
            } else {
                alert(result.code);
            }
        }, 'json');
    });


</script>


</body>
</html>